/*
 * @Author: llch
 * @Date: 2020-09-21 09:25:35
 * @LastEditTime: 2021-04-14 15:11:31
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \tower_defense_demo\assets\scripts\game_scene\enemy\enemy_base.ts
 */

import { EnemyState, EnemyDirection, EnemyAttr } from "../../game_data/enemy_data/enemy_data"

export class EnemyBase {

    public enemy_params: any = undefined;        // 敌人所有参数
    public enemy_speed: number = undefined;         // 敌人运动速度
    public enemy_health: number = undefined;        // 敌人血量
    public enemy_attack: number = undefined;        // 敌人攻击力
    public palyer_hurt: number = undefined;         // 敌人给玩家的伤害
    public reward_chip: number = undefined;         // 击败敌人后的怪物奖励

    public enemy_state: number = undefined;                 
    public enemy_dir: number = undefined;                

    constructor(enemy_params) {
        this.enemy_params = enemy_params;
        this.enemy_speed = enemy_params.speed;
        this.enemy_health = enemy_params.health;
        this.enemy_attack = enemy_params.attack;
        this.palyer_hurt = enemy_params.player_hurt;
        this.reward_chip = enemy_params.reward_chip;

        this.enemy_state = EnemyState.IDLE;
        this.enemy_dir = EnemyDirection.INVALID_DIR;
    }

    // 设置怪物基础参数
    public set_enemy_params(enemy_params): void {
        this.enemy_params = enemy_params;
        this.enemy_speed = enemy_params.speed;
        this.enemy_health = enemy_params.health;
        this.enemy_attack = enemy_params.attack;
        this.palyer_hurt = enemy_params.player_hurt;
        this.reward_chip = enemy_params.reward_chip;
    }

    // 获取怪物基础参数
    public get_enemy_params(): object {
        return this.enemy_params;
    }

    // 设置怪物状态
    public set_enemy_state(state: number): void {
        this.enemy_state = state;
    }

    // 获取怪物状态
    public get_enemy_state(): number {
        return this.enemy_state;
    }

    // 设置怪物移动方向
    public set_enemy_dir(dir: number): void {
        this.enemy_dir = dir;
    }

    // 获取怪物移动方向
    public get_enemy_dir(): number {
        return this.enemy_dir;
    }
}
